/**
 * 评论数据模型
 */

 module.exports = app => {

  const mongoose = app.mongoose, Schema = mongoose.Schema

  const kanbanSchema = new Schema({

    // 用户信息
    user: {
      type: Schema.Types.ObjectId,
      ref: 'User'
    },

    group: {
      type: Schema.Types.ObjectId,
      ref: 'Group'
    },

    name: {
      type: String
    },

    describe: {
      type: String
    },

    // 展示模块
    moduleList: [new Schema({
      module: {
        type: Schema.Types.ObjectId,
        ref: 'Module'
      },
      x: {
        type: Number
      },
      y: {
        type: Number
      },
      w: {
        type: Number
      },
      h: {
        type: Number
      }
    })],

    // 创建日期
    createdTime: {
      type: Date,
      default: Date.now
    },

    // 修改日期
    upTime: {
      type: Date,
      default: Date.now
    }
  })

  return mongoose.model('Kanban', kanbanSchema)
}